Skip to content

feat: Add sizebar support to PointPlot#6663

Merged
hoxbro merged 10 commits into
mainfrom
enh_size_bar
Aug 25, 2025
Merged

feat: Add sizebar support to PointPlot#6663
hoxbro merged 10 commits into
mainfrom
enh_size_bar

Conversation

@hoxbro

@hoxbro hoxbro commented Aug 13, 2025

Copy link
Copy Markdown
Member

Heavily inspired by the scalebar work, see #6002.

Todos:

Though I want to wait with this until the PR has been merged.

  • Add test
  • Add documentation
  • Check how it behaves with Overlay
  • Add to polygons?
import numpy as np

import holoviews as hv
from holoviews.plotting.util import rgb2hex

np.random.seed(1)  # noqa: NPY002
N = 100
x = np.random.random(size=N) * 100  # noqa: NPY002
y = np.random.random(size=N) * 100  # noqa: NPY002
radii = np.random.random(size=N) * 10  # noqa: NPY002
colors = np.array([(r, g, 150) for r, g in zip(50 + 2*x, 30 + 2*y, strict=True)], dtype=np.uint8)
# colors = colors.view(dtype=np.uint32).reshape(colors.shape[:-1])
colors = list(map(rgb2hex, colors / 256))

hv.extension("bokeh")

a = hv.Points((x, y, radii, colors), vdims=["radii", "colors"])
a = a.opts(color="colors", radius="radii", tools=["hover", "examine"], alpha=0.6, height=800, width=800, sizebar=True)
# a = a.opts(color="colors", radius="radii", tools=["hover", "examine"], alpha=0.6, height=800, width=800, sizebar=True, sizebar_orientation="horizontal", sizebar_location="right")
# a = a.opts(color="colors", radius="radii", tools=["hover", "examine"], alpha=0.6, height=800, width=800, sizebar=True, sizebar_orientation="vertical", sizebar_location="right")

__import__("panel").panel(a).servable()
image

@codecov

codecov Bot commented Aug 13, 2025

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 93.39623% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 88.96%. Comparing base (3936a74) to head (b0047af).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
holoviews/plotting/bokeh/chart.py 85.29% 5 Missing ⚠️
holoviews/tests/plotting/bokeh/test_pointplot.py 97.18% 2 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##             main    #6663    +/-   ##
========================================
  Coverage   88.96%   88.96%            
========================================
  Files         328      328            
  Lines       70119    70221   +102     
========================================
+ Hits        62378    62473    +95     
- Misses       7741     7748     +7     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@hoxbro hoxbro changed the title enh: Add sizebar support to PointPlot feat: Add sizebar support to PointPlot Aug 13, 2025
@hoxbro
hoxbro marked this pull request as ready for review August 19, 2025 13:20
@droumis
droumis requested a review from philippjfr August 19, 2025 15:22
@hoxbro
hoxbro merged commit d68d810 into main Aug 25, 2025
14 checks passed
@hoxbro
hoxbro deleted the enh_size_bar branch August 25, 2025 09:24
@droumis droumis added this to NIH-NCI Aug 27, 2025
@github-actions

github-actions Bot commented Dec 9, 2025

Copy link
Copy Markdown
Contributor

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Dec 9, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

3 participants